package com.csit.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="T_SaleDetail")
public class SaleDetail implements Serializable {
	
	private static final long serialVersionUID = 7455877109747015669L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer saleDetailID;
	
	@Column(updatable=false)
	private Integer position;
	
	@Column(precision=2)
	private Double quantity;
	
	@Column(precision=2)
	private Double price;
	
	private Double amount;
	//是否是赠品
	private Boolean isFree;
	
	@Column(length=1000)
	private String note;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="productID")
	private Product product;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="saleID")
	private Sale sale;

	public Integer getSaleDetailID() {
		return saleDetailID;
	}

	public void setSaleDetailID(Integer saleDetailID) {
		this.saleDetailID = saleDetailID;
	}

	public Integer getPosition() {
		return position;
	}

	public void setPosition(Integer position) {
		this.position = position;
	}

	public Double getQuantity() {
		return quantity;
	}

	public void setQuantity(Double quantity) {
		this.quantity = quantity;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Sale getSale() {
		return sale;
	}

	public void setSale(Sale sale) {
		this.sale = sale;
	}

	public Boolean getIsFree() {
		return isFree;
	}

	public void setIsFree(Boolean isFree) {
		this.isFree = isFree;
	}
}
